package com.lagou.edu.springbootcache.controller;

import com.lagou.edu.springbootcache.service.CacheService;
import com.lagou.edu.springbootcache.vo.LagouWorkReqVo;
import com.lagou.edu.springbootcache.vo.LagouWorkRespVo;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

@RestController
@RequestMapping(value = "/cache")
public class CacheController {

    @Autowired
    private CacheService cacheService;

    @PostMapping("/addCache")
    public void addCache(@RequestBody LagouWorkReqVo reqVo){
        cacheService.addCache(reqVo);
    }

    @PostMapping("/getCache")
    public LagouWorkRespVo getCache(String workId){
        return cacheService.getCache(workId);
    }

}
